package cn.tedu.store.config;

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.util.Scanner;

public class UDPClient {
    public static void main(String[] args) throws Exception{

        System.out.println("udp服务端启动");
        //
     DatagramSocket socket =  new DatagramSocket();

        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入传输内容：");
        String next = scanner.next();
        DatagramPacket datagramPacket = new DatagramPacket(next.getBytes(), next.getBytes().length, InetAddress.getByName("127.0.0.1"), 8080);
        socket.send(datagramPacket);
        //
        socket.close();
    }
}
